package cn.ztuo.bitrade.service;

import cn.ztuo.bitrade.dao.ContractOrderDetailServiceMapper;
import cn.ztuo.bitrade.entity.ContractOrder;
import cn.ztuo.bitrade.entity.ContractOrderDetail;
import cn.ztuo.bitrade.pagination.Criteria;
import cn.ztuo.bitrade.pagination.Restrictions;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class ContractOrderDetailService {

    @Autowired
    private ContractOrderDetailServiceMapper serviceMapper;

    /*public List<ContractOrderDetail> findByDirection(String symbol) {
        return serviceMapper.findByDirection(symbol);
    }*/

    public List<ContractOrderDetail> findAllByOrderId(String orderId) {
        return serviceMapper.findAllByOrderId(orderId);
    }
    public List<ContractOrderDetail> findByMemberId(List<String> orderIds) {
        //从第一条开始查
        Criteria<ContractOrder> specification = new Criteria<ContractOrder>();
        specification.add(Restrictions.in("orderId", orderIds, false));
        return serviceMapper.findAllByOrderIdIn(orderIds);
    }

    public void save(ContractOrderDetail orderDetail) {
        serviceMapper.save(orderDetail);
    }


}
